1 <?php
2 include(
"header.php");
3 include(
"sidebar.php");
4
5 include(
"dbconnection.php");
6 if
(isset($_GET['testid']))
7 {
8 $results = mysql_query(
"DELETE from testdrive where bookingid ='$_GET[testid]'");
9 }

10 if
(isset($_SESSION['custid']))
11 {
12 $result = mysql_query(
"select * from testdrive where custid='$_SESSION[custid]'");
13 }

14 else

15 {
16 $result= mysql_query(
"select * from testdrive");
17 }
18 ?>
19         
20                             
21         <div id=
"main">
22             
23             <a name=
"TemplateInfo"></a>
24             <h1>Test drive</h1>
25             <?php
26
27     echo
"<center><b><a href='testdrive.php'>Add New test drive</a></b></center>";
28
29     ?>
30         <form id=
"form1" name="form1" method="post" action="">
31           <table width=
"686" border="1">
32             <tr>
33               <th scope=
"col">Booking ID</th>
34               <th scope=
"col">Vehicle ID</th>
35               <th scope=
"col">Customer ID</th>
36               <th scope=
"col">Date</th>
37               <th scope=
"col">Time</th>
38               <th scope=
"col">Comments</th>
39                 <th scope=
"col">Status</th>
40               <th scope=
"col">Action</th>
41             </tr>
42              <?php
43           
while($arrrec= mysql_fetch_array($result))
44           {
45           
46 $result1= mysql_query(
"select * from testdrive where vehicleid='$arrrec[vehicleid]'");
47 $arrrec1= mysql_fetch_array($result1);
48
49             echo
"<tr>
50               <th scope='col'>$arrrec[bookingid]</th>
51               <th scope='col'>$arrrec[vehicleid]</th>
52               <th scope='col'>$arrrec[custid]</th>
53               <th scope='col'>$arrrec[date]</th>
54               <th scope='col'>$arrrec[time]</th>
55                <th scope='col'>$arrrec[comments]</th>
56               <th scope='col'>$arrrec[status]</th>
57               <th scope='col'>"
; if(!isset($_SESSION['custid'])) { ?><?php echo "<a href='testdrive.php?testid=$arrrec[bookingid]'>Edit</a> | "; ?><?php } ?>
58                 <?php echo
"<a href='viewtestdrive.php?testid=$arrrec[bookingid]'>Delete</a></th>
59             </tr>"
;
60             }
61          ?>
62           </table>
63         </form>
64
65           <p>&nbsp;</p>
66 <br />
67                                             
68         </div>
69         
70 <!-- wrap ends here -->
71 </div>
72         
73 <?php
74 include(
"footer.php");
75 ?>


Gõ tìm kiếm nhanh...